package com.cyys.modules.config;

import com.cyys.common.xss.XssHttpServletRequestWrapper;
import org.springframework.context.annotation.Configuration;

import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @Title: FilterConfig
 * @ProjectName cyys-parent
 * @Description: 特殊处理类  拦截请求设置param参数
 * @Author lishengquan
 * @Date 2019/7/9 12:11
 * @Version 1.0
 */
@Configuration
public class SysConfig  implements Filter {


    @Override
    public void destroy() {
    }

    @Override
    public void init(javax.servlet.FilterConfig filterConfig) throws ServletException {

    }

    @Override
    public void doFilter(ServletRequest request, ServletResponse response,
                         FilterChain filterChain) throws IOException, ServletException {
        FilterConfig.SetRequest(new XssHttpServletRequestWrapper((HttpServletRequest) request));
        FilterConfig.setResponse((HttpServletResponse) response);
        filterChain.doFilter(FilterConfig.getRequest(), FilterConfig.getResponse());
    }


}
